﻿using System.Collections.ObjectModel;
using System.ComponentModel;

namespace wms.Model
{
    public class TypeModel : INotifyPropertyChanged
    {
        private int id;
        private string name;
        private string fullName;
        private TypeModel parent;
        private ObservableCollection<TypeModel> childern;


        public TypeModel() {
            this.Childern = new ObservableCollection<TypeModel>();
        }

        public TypeModel(int id,string name)
        {
            this.Id = id;
            this.Name = name;
            this.Childern = new ObservableCollection<TypeModel>();
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected internal virtual void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null) {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }


        public int Id
        {
            get
            {
                return id;
            }

            set
            {
                id = value;
                OnPropertyChanged("Id");
            }
        }

        public string Name
        {
            get
            {
                return name;
            }

            set
            {
                name = value;
                OnPropertyChanged("Name");
            }
        }

        public string FullName
        {
            get
            {
                return fullName;
            }

            set
            {
                fullName = value;
                OnPropertyChanged("FullName");
            }
        }

        public TypeModel Parent
        {
            get
            {
                return parent;
            }

            set
            {
                parent = value;
                OnPropertyChanged("Parent");
            }
        }

        public ObservableCollection<TypeModel> Childern
        {
            get
            {
                return childern;
            }

            set
            {
                childern = value;
                OnPropertyChanged("Childern");
            }
        }
    }
}
